package operation;

import book.BookList;

import java.util.Scanner;

public class FindOperation implements Ioperation{//查书
    public void work(BookList bookList){
        while(true){
            int a=0;
            Scanner ip=new Scanner(System.in);
            System.out.println("请输入你要查询的书：");
            String name=ip.nextLine();
            for (int j=0;j<bookList.getNum();j++){
                if (name.equals(bookList.getBook(j).getName())){
                    System.out.println("找到这本书了...");
                    a=1;
                    System.out.println(bookList.getBook(j));
                    break;
                }
            }
            if (a==0)
                System.out.println("没有这本书");

            System.out.println("是否继续查找吗");
            System.out.println("1.继续 2.退出");
            int end = ip.nextInt();
            if (end == 1)
                ;
            else break;
        }
    }
}
